/* 
 * This file is part of FreeBMS - an open source battery management system
 *
 * Options Headers
 * 
 * NOTE: This code is designed to be compiled using SOURCEBOOST (http://www.sourceboost.com)
 */
 
/* This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef _OPTIONS_H_
#define _OPTIONS_H_

// XXX - Temporary defines
#define MIN_VOLTAGE			2600	// Minimum cell voltage, cutoff discharge at this value (unit is V * 1000)
#define MAX_VOLTAGE			3600	// Maximum cell voltage, cutoff charger at this value (unit is V * 1000)
#define BALANCE_VOLTAGE		3399	// Minimum voltage for lowest cell to begin balancing at
#define DIFF_VOLTAGE		10		// Keep battery voltages within a margin of this AD value
#define NUM_CELLS			80		// Number of regulator boards to cycle through
#define BAUD_RATE			1		// Baud rate for serial communication (0:2400, 1:9600, etc)
#define TIMER_PAUSE			80		// (10 = 1 second) Wait inbetween shunting evaluations
#define TIMER_SHUNT 		1200	// (10 = 1 second) Duration of a shunting evaluation
#define SHUNTING			1		// Enable or disable sending shunting requests

// Global Values
#define MESSAGE_HISTORY 	5		// Number of messages to keep track records of for voltage
//#define TIMER_ERRORS		6000	// 10 minute timeout before we decrement error counter
#define TIMER_ERRORS		600
#define TIMER_RELAY			10		// Duration for relay timer (100ms ticks)
#define TIMER_OPMODE		20		// Ticks to wait before changing operation mode
#define TIMER_WATCHDOG		5		// Ticks(10ms) to wait before clearing external watchdog

// Global Options
#define MAX_DTC_STORE		5		// Store last 5 DTC messages in buffer until cleared
#define MAX_CAN_ERRORS		5		// Number of CANBUS errors before triggering error
#define MAX_COMM_ERRORS		10
//#define MAX_COMM_ERRORS		3		// Number of communication errors before triggering error code
#define MAX_CELL_ERRORS		10
//#define MAX_CELL_ERRORS		3		// Number of invalid results from a regulator cell before triggering error
#define METER_ENABLED		1		// Enable or disable battery LED meter
#define WDT_ENABLED			1		// Enable or disable watchdog timer (resets chip if locks up)
#define BUZZER_ENABLED		1		// Enable or disable the onboard buzzer for error conditions
#define CELLBCAST_ENABLED	1		// Enable or disable individual cell voltage broadcasts
#define SENSOR_ENABLED		1		// Enable or disable current sensor
#define CANCUTOFF_ENABLED	0		// Enable or disable CANBUS error cutoff condition
#define CLEARBUTTON_ENABLED	0		// Enable or disable DTC clearing button
#define ADC_DEBUG			0		// Enable or disable ADC debugging (publishes values to CANBUS)

#endif // _OPTIONS_H_